/**
 * takes an Component of type input and a string of Binary values and add's any single value to an arraylist.
 * 
 * @author Giuseppe Mendola (giuseppe.mendola@usi.ch); 
 */
package ch.usi.inf.pf2.gui;


import java.util.ArrayList;

import ch.usi.inf.pf2.Component;
import ch.usi.inf.pf2.Value;

public class ArrayListInput {

	private String multipleInput;
	private ArrayList<Value> values;
	private int inputLength;
	private Component input;

	public ArrayListInput(String multipleInput, Component input) {
		this.setInput(input);
		this.multipleInput = multipleInput;;
		inputLength = this.multipleInput.length();
		System.out.println(multipleInput);
		this.values = new ArrayList<Value>();

		for (int i = 0; i < inputLength; i++) {
			String singleInput = multipleInput.substring(i, i + 1);
			if (singleInput.equals("0")) {
				values.add(Value.FALSE);
			} else if (singleInput.equals("1")) {
				values.add(Value.TRUE);
			}
			System.out.println(values.get(i));
		}
	}

	public String getMultipleInput() {
		return multipleInput;
	}

	public void setInput(String multipleInput) {
		this.multipleInput = multipleInput;
	}

	public ArrayList<Value> getValues() {
		return values;
	}

	public void setValues(ArrayList<Value> values) {
		this.values = values;
	}

	/**
	 * @param inputLength the inputLength to set
	 */
	public void setInputLength(int inputLength) {
		this.inputLength = inputLength;
	}

	/**
	 * @return the inputLength
	 */
	public int getInputLength() {
		return inputLength;
	}

	/**
	 * @param input the input to set
	 */
	public void setInput(Component input) {
		this.input = input;
	}

	/**
	 * @return the input
	 */
	public Component getInput() {
		return input;
	}


}